#include "complex.h"

Complex::Complex()  
  {                        
    (*this).real=0.0;
    (*this).imag=0.0;
  }
Complex::Complex(double real,double imag)
  { 
    (*this).real=real;
    (*this).imag=imag;
   }
Complex Complex::operator+(Complex c)
  {
		 Complex s;
     double real;
     double imag;
     real=(*this).real+c.getReal(); 
     imag=(*this).imag+c.getImag();
     s=Complex(real,imag);
     return s;	   
   }
double Complex::getReal() 
  {  
    double real;
	  real=(*this).real;
	  return real;
  }
double Complex::getImag()
  {
     double imag;
	   imag=(*this).imag;
	   return imag;
  }
void Complex::setReal(double real)
  {
    (*this).real=real;
  }
void Complex::setImag(double imag)
  {
	  (*this).imag=imag;  
  }
void Complex::operator++()
	{
	double s;
	double d;
	s=(*this).getReal();
	s=s+1;
	(*this).setReal(s);
	}
ostream& operator<<(ostream& cout,Complex B)
	{
	std::cout<<"Partea reala : "<<B.getReal()<<" Partea imaginara : "<<B.getImag()<<".";
	return cout;
	}
vector::vector(int n)
	{
	double a,b;
	(*this).setNrPct(n);		
	for(int i=0;i<(*this).getNrPct();i++)
		{
		std::cout<<"\nSe va citi numarul complex de pe poz "<<i<<".\n";
		std::cout<<"Real : ";std::cin>>a;
		cout<<"Imaginar : ";std::cin>>b;
		(*this).b[i]=Complex(a,b);
		}
	}
void vector::setNrPct(int m)
	{
	(*this).nrpct=m;	
	}
int vector::getNrPct()
	{
	return (*this).nrpct;	
	}
Complex vector::suma()
	{
	Complex d;
	for(int i=0;i<(*this).getNrPct();i++)
		{
		d=d+(*this).b[i];
		}
	return d;
	}
void vector::incrementare()
	{
	Complex D;
	for(int i=0;i<(*this).getNrPct();i++)
		{
		D=Complex((*this).b[i].getReal(),(*this).b[i].getImag());
		++D;
		(*this).b[i]=D;	
		}
	}
ostream& operator<<(ostream& cout,vector B)
	{	
	for(int i=0;i<B.getNrPct();i++)
	std::cout<<"Partea reala : "<<B.b[i].getReal()<<" Partea imaginara : "<<B.b[i].getImag()<<"."<<endl;
	return cout;
	}


